# -*- encoding: utf-8 -*-
"""

PyCharm zip函数对可迭代对象进行打包.py
2024年10月20日10时18分
by wenyang

"""


def main():
    str_list = ["hello", "world", "ipython", "javascript"]
    int_tuple = (1, 2, 3, 4, 5)
    int_list = range(4)
    zip_obj = zip(str_list, int_tuple)
    print(zip_obj)
    print(list(zip(str_list, int_list)))
    print(list(zip_obj)) # zip_obj是一个迭代器对象 只能遍历一次 之后就是不能再次遍历了
    print(tuple(zip(str_list, int_tuple)))
    name = ["wenyang", "xiaoming", "xiaohong"]
    age = [18, 19, 20]
    gender = ["man", "man", "woman"]
    print(list(zip(name, age, gender)))
    print(*list(zip(name, age, gender)))
    info_stu = list(zip(name, age, gender))
    # 通过这种方式就是可以进行遍历操作
    for name, age, gender in info_stu:
        print(f"name: {name}, age: {age}, gender: {gender}")




if __name__ == "__main__":
    main()
